import { useRequest } from "./config/index.js";

export function useAuthApi() {
  const { request } = useRequest();

  const login = async (credentials) => {
    const loginData = credentials;

    const response = await request({
      url: "/auth/login",
      method: "POST",
      data: loginData,
      showLoading: true,
    });

    return response;
  };

  const register = async (createUser) => {
    const user = createUser;

    const respose = await request({
      url: "/auth/register",
      method: "POST",
      data: user,
      showLoading: true,
    });

    return respose;
  };

  return { login, register };
}
